package nancal.mp.mvc.sys

import com.warrenstrange.googleauth.GoogleAuthenticator
import io.swagger.annotations.*
import nancal.mp.client.node.NodeJsClient
import nancal.mp.db.mongo.*
import nancal.mp.db.mongo.entity.*
import nancal.mp.db.mongo.entity.sys.*
import nbcp.base.annotation.*
import nbcp.base.annotation.mvc.*
import nbcp.base.comm.*
import nbcp.base.db.LoginUserModel
import nbcp.base.extend.*
import nbcp.mvc.sys.*
import nbcp.myoql.db.*
import nbcp.myoql.db.mongo.*
import nbcp.web.*

import org.springframework.beans.factory.annotation.Autowired
import org.springframework.data.mongodb.core.query.*
import org.springframework.web.bind.annotation.*
import java.time.*
import javax.servlet.http.*

/**
 * Created by CodeGenerator at 2024-02-06 00:24:37
 */
@Api(description = "Api路由定义", tags = arrayOf("ApiRouterDefine"))
@RestController
@RequestMapping("/sys")
@OpenAction
class SystemController {

    @Autowired
    lateinit var nodeJsClient: NodeJsClient;

    @ApiOperation("exec-curl")
    @PostMapping("/exec-curl")
    fun execCurl(
        @RequestBody curl: String,
        request: HttpServletRequest
    ): String {
        return nodeJsClient.execCurl(curl);
    }


//    fun getAuthKey(loginUser:LoginUserModel):ApiResult<String>{
//        var gAuth = GoogleAuthenticator();
//        var secretKey = gAuth.createCredentials().getKey()
//
//        var uri = "otpauth://totp/${loginUser.loginName}?secret=密钥&issuer=拓海开发后台";
//        String qrCodeBase64 = QrCodeUtils.generateQRCode(uri);
//    }
//
//    fun getAuthQrCode(): ApiResult<String> {
//
//    }

}